package com.sunday.electric.fragment;

import android.content.Intent;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;

import com.sunday.common.utils.Constants;
import com.sunday.electric.R;
import com.sunday.electric.base.BaseFragment;
import com.sunday.electric.ui.LoginActivity;
import com.sunday.electric.ui.mine.AddOrderActivity;
import com.sunday.electric.ui.mine.HelpActivity;
import com.sunday.electric.ui.mine.NoticeActivity;
import com.sunday.electric.ui.mine.OnLineHelpActivity;
import com.sunday.electric.ui.mine.PersonInfoActivity;
import com.sunday.electric.ui.mine.RecentChatActivity;
import com.sunday.electric.ui.mine.SearchActivity;
import com.sunday.electric.ui.mine.SettingActivity;
import com.sunday.electric.utils.SharePerferenceUtils;

import butterknife.Bind;
import butterknife.ButterKnife;
import butterknife.OnClick;

/**
 * Created by Administrator on 2016/1/9.
 */
public class MineFragment extends BaseFragment {
    @Bind(R.id.left_btn)
    ImageView leftImg;
    @Nullable
    @Override
    public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
        rootView = inflater.inflate(R.layout.fragment_mine,null);
        ButterKnife.bind(this,rootView);

        return rootView;
    }

    @Override
    public void onActivityCreated(@Nullable Bundle savedInstanceState) {
        super.onActivityCreated(savedInstanceState);
        leftImg.setVisibility(View.GONE);
    }

    @OnClick(R.id.person_info)
    void personInfo(){
        intent = new Intent(mContext, PersonInfoActivity.class);
        startActivity(intent);
    }

    @OnClick(R.id.content_search)
    void contentSearch(){
        intent = new Intent(mContext, SearchActivity.class);
        startActivity(intent);
    }

    @OnClick(R.id.notice)
    void noitice(){
        intent = new Intent(mContext, NoticeActivity.class);
        startActivity(intent);
    }

    @OnClick(R.id.safe_scan)
    void safeScan(){

    }

    @OnClick(R.id.add_new_order)
    void addNewsOrder(){
        intent = new Intent(mContext, AddOrderActivity.class);
        startActivity(intent);
    }

    @OnClick(R.id.online_help)
    void onLineHelp(){
        intent = new Intent(mContext, RecentChatActivity.class);
        startActivity(intent);
    }

    @OnClick(R.id.setting)
    void setting(){
        intent = new Intent(mContext, SettingActivity.class);
        startActivity(intent);
    }

    @OnClick(R.id.help)
    void help(){
        intent = new Intent(mContext, HelpActivity.class);
        startActivity(intent);
    }

    @OnClick(R.id.logout)
    void logout(){
        getActivity().finish();
        SharePerferenceUtils.getIns().reset();
        SharePerferenceUtils.getIns().removeKey(Constants.IS_LOGIN);
        intent = new Intent(mContext, LoginActivity.class);
        startActivity(intent);
    }
}
